home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / ka9q / kit_src / putcur.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-03  |  1.2 KB  |  55 lines

  1. /*    (C) Copyright 1991 Dave Fritsche (wb8zxu), All Rights Reserved.
  2.  * 
  3.  *    Redistribution and use in source and binary forms are permitted for
  4.  *    non-commercial use, provided that the above copyright notice and this
  5.  *    paragraph are duplicated in all such forms.  THIS SOFTWARE IS PROVIDED
  6.  *    ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
  7.  *    WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
  8.  *    FITNESS FOR A PARTICULAR PURPOSE.
  9.  */
  10. /*bdoc
  11.  *    Function "PUTCUR"
  12.  *
  13.  *    Written:  Dave Fritsche
  14.  *    Date:  July, 1987
  15.  *
  16.  *    A function to position the cursor on the screen.  Syntax:
  17.  *        putcur(x, y)
  18.  *    where "x" is the column number of the screen and "y" is the line
  19.  *    number.
  20.  edoc*/
  21.  
  22. #include <stdio.h>
  23.  
  24. #define BIOS
  25.  
  26. #ifdef BIOS
  27. #include <dos.h>
  28.  
  29. #define VIDEO_IO    0x10
  30. #define SETPOS        0x02
  31. #endif
  32.  
  33. putcur(x, y)
  34. int x, y;
  35. {
  36. #ifdef BIOS
  37.     union REGS in_regs, out_regs;
  38. #endif
  39.  
  40.     if (x > 80) x = 80;
  41.     if (y > 25) y = 25;
  42.     if (x < 1 ) x =  1;
  43.     if (y < 1 ) y =  1;
  44.  
  45. #ifdef BIOS
  46.     in_regs.h.ah = SETPOS;
  47.     in_regs.h.bh = 0;
  48.     in_regs.h.dh = y - 1;
  49.     in_regs.h.dl = x - 1;
  50.     int86(VIDEO_IO, &in_regs, &out_regs);
  51. #else
  52.     printf("%c[%d;%dH", 27, y, x);
  53. #endif
  54. }
  55.